package hub.cathome.entity.tool;

import org.apache.ibatis.io.Resources;

import java.io.File;
import java.util.Properties;

public class ApplicationProperties {
    public static String server_static_path;
    static{
        try{
            Properties properties = Resources.getResourceAsProperties("base.properties");
            if(System.getProperty("os.name").toLowerCase().contains("win")){
                server_static_path = properties.getProperty("resource.windows_upload");
            }else{
                server_static_path = properties.getProperty("resource.linux_upload");
            }
            System.out.println("ApplicationProperties 初始化本地文件存储地址: "+server_static_path);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public static String getAbsoluteLocalPath(String relative_path){
        return server_static_path+File.separator+relative_path;
    }

    public static String getDefaultImgPath() {
        return server_static_path+File.separator+"whichcat.jpg";
    }
}
